import request from '@/config/axios'


export interface ProductVO {
  id: number
  productName: string
  iconStr: string
  maxAmount: string
  annualInterest: string
  loanTime: string
  productType: string
  productLable: string
  productIntroduce: string
  productImg: string
  status: string
}


// 查询产品管理列表
export const getProductPage = async (params) => {
  return await request.get({ url: `/hutai/product/page`, params })
}

export const getProductsList = async (id: number) => {
  return await request.get({ url: `/hutai/product/plist?id=` +id })
}

// 查询产品管理详情
export const getProduct = async (id: number) => {
  return await request.get({ url: `/hutai/product/get?id=` + id })
}

//查询字眼
export const getWordingByKey = async (key: string) => {
  return await request.get({ url: `/hutai/product/getWordingByKey?key=` + key })
}

//修改字眼
export const updateWording = async (data) => {
  return await request.post({ url: `/hutai/product/updateWording`, data })
}

// 新增产品管理
export const createProduct = async (data: ProductVO) => {
  return await request.post({ url: `/hutai/product/create`, data })
}

export const createOrUpdateProducts = async (data) => {
  return await request.post({ url: `/hutai/product/createOrUpdateProducts`, data })
}

// 修改产品管理
export const updateProduct = async (data: ProductVO) => {
  return await request.put({ url: `/hutai/product/update`, data })
}

// 删除产品管理
export const deleteProduct = async (id: number) => {
  return await request.delete({ url: `/hutai/product/delete?id=` + id })
}

// 导出产品管理 Excel
export const exportProduct = async (params) => {
  return await request.download({ url: `/hutai/product/export-excel`, params })
}
